<?php
header("Content-Type:text/html;charset=UTF-8");
include("./API.php");
include("../config.php");
tongji("qzl");
$hh=$_GET["hh"]?:"\n";//换行符号(默认\n)
$url="https://qinfo.clt.qq.com/cgi-bin/qun_info/get_group_info_all";
$data='gc='.$_GET["group"].'&bkn='.getGTK($_GET["skey"]).'';
$return_content=http_post_data($url, $data);
$pst= json_decode($return_content);
$hw_id=$pst->ec;
if($hw_id==0){
$a=$pst->gIntro;//群介绍
$b=$pst->gName;//群聊名称
$b=str_replace("&nbsp;"," ","".$b."");
$c=$pst->gMemNum;//群人数
$e=$pst->gOwner;//群主qq
$result=preg_match_all('/gAdmins":(.*?),"ns"/',$return_content,$arr);
echo "".$web["ming"]."API♧QQ群资料".$hh."";
echo "━━━━━━━━━".$hh."";
echo "群名：".$b."".$hh."";
echo "群人数：".$c."".$hh."";
echo "群主qq：".$e."".$hh."";
echo "管理员：".$arr[1][0]."".$hh."";
echo "群介绍：".$a."".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
}else
if($hw_id==1){
echo "".$web["ming"]."API♧QQ群资料".$hh."";
echo "━━━━━━━━━".$hh."";
echo "参数错误".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
}

function getGTK($skey){
$len = strlen($skey);
$hash = 5381;
for ($i = 0; $i < $len; $i++) {
$hash += ($hash << 5 & 2147483647) + ord($skey[$i]) & 2147483647;
$hash &= 2147483647;
}
return $hash & 2147483647;
}

function http_post_data($url, $data_string) {
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	"Content-Type: application/x-www-form-urlencoded",
		"Content-Length: " . strlen($data_string),
		"Cookie: p_uin=o".$_GET["qq"]."; uin=o".$_GET["qq"]."; skey=".$_GET["skey"]
		));
	ob_start();
	curl_exec($ch);
	$return_content = ob_get_contents();
	ob_end_clean();
	return $return_content;
}
?>